﻿var __IsIE = (navigator.userAgent.indexOf(' MSIE ') > -1?true:false);
function $(element) 
{
  if (arguments.length > 1) 
  {
    for (var i = 0, elements = [], length = arguments.length; i < length; i++)
      elements[i]=$(arguments[i]);
    return elements;
  }
  if (typeof element == 'string')
    element = document.getElementById(element);
  return element;
}
var $get = $;
function $trim$(strObj) 
{
    return strObj.replace(/^\s+|\s+$/g, '');
}
document.write("<div id='$MessageBox$' style='position:absolute; top:0px; left:0px;display:none;z-index:100'><div class='popup_title'><div id='$Title$' class='floatl'></div><div class='floatr'><a href='#'><img src='/images/icon_pop_close.gif' border='0' onclick='$EndMessageBox$()'></a></div><div class='clear'></div></div><div class='popup_content' id='$Message$'></div><div class='popup_button' id='$divIput$'><input type='button' id='__P_OK' value='ok' class='button'/>&nbsp;&nbsp;<input type='button' id='__P_C' onclick='$EndMessageBox$()' value='cancel' class='buttong'/></div></div>");
var $MessageBoxObj$ = $('$MessageBox$');
var $TitleObj$ = $('$Title$');
var $MessageObj$ = $('$Message$');

// 转换为数字
function $intval$(v)
{
    v = parseInt(v);
    return isNaN(v) ? 0 : v;
}

// 获取元素信息,返回对象x：水平位置;y：垂直位置;w：对象样式宽度;h：对象样式高度wb：对象宽度;hb：对象宽度
function $getPos$(e)
{
    var l = 0;
    var t  = 0;
    var w = $intval$(e.style.width);
    var h = $intval$(e.style.height);
    var wb = e.offsetWidth;
    var hb = e.offsetHeight;
    while (e.offsetParent){
        l += e.offsetLeft + (e.currentStyle?$intval$(e.currentStyle.borderLeftWidth):0);
        t += e.offsetTop  + (e.currentStyle?$intval$(e.currentStyle.borderTopWidth):0);
        e = e.offsetParent;
    }
    l += e.offsetLeft + (e.currentStyle?$intval$(e.currentStyle.borderLeftWidth):0);
    t  += e.offsetTop  + (e.currentStyle?$intval$(e.currentStyle.borderTopWidth):0);
    return {x:l, y:t, w:w, h:h, wb:wb, hb:hb};
}
// 锚点(Anchor)间平滑跳转
function $scroller$(el, duration)
{
    if(typeof el != 'object') { el = $(el); }
    if(!el) return;
    var z = this;
    z.el = el;
    z.p = $getPos$(el);
    z.s = $getScroll$();
    z.clear = function(){window.clearInterval(z.timer);z.timer=null};
    z.t=(new Date).getTime();

    z.step = function(){
        var t = (new Date).getTime();
        var p = (t - z.t) / duration;
        if (t >= duration + z.t) {
            z.clear();
            window.setTimeout(function(){z.scroll(z.p.y, z.p.x)},13);
        } else {
            st = ((-Math.cos(p*Math.PI)/2) + 0.5) * (z.p.y-z.s.t) + z.s.t;
            sl = ((-Math.cos(p*Math.PI)/2) + 0.5) * (z.p.x-z.s.l) + z.s.l;
            z.scroll(st, sl);
        }
    };
    z.scroll = function (t, l){window.scrollTo(l, t)};
    z.timer = window.setInterval(function(){z.step();},13);
}

//获取滚动条信息，返回对象t：垂直滚动位置;l：水平滚动位置;w：页宽度;h：页高度
function $getScroll$() 
{
    var t, l, w, h;
    
    if (document.documentElement && document.documentElement.scrollTop) {
        t = document.documentElement.scrollTop;
        l = document.documentElement.scrollLeft;
        w = document.documentElement.scrollWidth;
        h = document.documentElement.scrollHeight;
    } else if (document.body) {
        t = document.body.scrollTop;
        l = document.body.scrollLeft;
        w = document.body.scrollWidth;
        h = document.body.scrollHeight;
    }
    return { t: t, l: l, w: w, h: h };
}
//获取页滚动条信息,返回数组0：水平滚动位置;1：垂直滚动位置
function $getPageScroll$(){

    var yScroll;
    var xScroll;
    if (self.pageYOffset) {
        yScroll = self.pageYOffset;
        xScroll = self.pageXOffset;
    } else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
        yScroll = document.documentElement.scrollTop;
        xScroll = document.documentElement.scrollLeft;
    } else if (document.body) {// all other Explorers
        yScroll = document.body.scrollTop;
        xScroll = document.body.scrollLeft;
    }

    arrayPageScroll = new Array(xScroll,yScroll) 
    return arrayPageScroll;
}
//得到页大小，返回数组0：页宽度;1：页高度;2：窗口宽度;3：窗口高度
function $getPageSize$(){
	
    var xScroll, yScroll;
	
    if (window.innerHeight && window.scrollMaxY) {	
        xScroll = document.body.scrollWidth;
        yScroll = window.innerHeight + window.scrollMaxY;
    } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
        xScroll = document.body.scrollWidth;
        yScroll = document.body.scrollHeight;
    } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
        xScroll = document.body.offsetWidth;
        yScroll = document.body.offsetHeight;
    }
	
    var windowWidth, windowHeight;
    if (self.innerHeight) {	// all except Explorer
        windowWidth = self.innerWidth;
        windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
        windowWidth = document.documentElement.clientWidth;
        windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
        windowWidth = document.body.clientWidth;
        windowHeight = document.body.clientHeight;
    }	
	
    // for small pages with total height less then height of the viewport
    if(yScroll < windowHeight){
        pageHeight = windowHeight;
    } else { 
        pageHeight = yScroll;
    }

    // for small pages with total width less then width of the viewport
    if(xScroll < windowWidth){	
        pageWidth = windowWidth;
    } else {
        pageWidth = xScroll;
    }

    arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
    return arrayPageSize;
}
var $ProgressTimer$ = null;
function $showProgressBar$(visible,flag) 
{
    var obj = $("$progress$");
    if(obj==null)
    {
    		var oDiv;
        try{oDiv = document.createElement("<div>")}catch(e){oDiv = document.createElement("div")};
        oDiv.id = "$progress$";
        var text;
		if(typeof(loading) != "undefined")
		{
			text = document.createTextNode(loading);
		}
		else
		{
			text = document.createTextNode("Loading...");
		}
        oDiv.appendChild(text);
        oDiv.style["left"]=0;oDiv.style["top"]=0;
        document.body.appendChild(oDiv);
        obj = $("$progress$");
        obj.style["backgroundColor"] = "#CC3333";
        obj.style["color"] = "#fff";
        obj.style["padding"] = "3px 20px 3px 20px";
        obj.style["margin"] = "2px 0px 0px 2px";
        obj.style["font"] = "14px Arial";
}
    var pScroll = $getPageScroll$();
    obj.style["position"] = "absolute";
    obj.style["z-index"] = "1000";
    obj.style["left"] = pScroll[0] + "px";
    obj.style["top"] = pScroll[1] + "px";
    obj.style["display"] =  visible ? "block" : "none";
    if(flag) $ShowBG$(flag)
}
var showProgressBar = $showProgressBar$;
function $SetProgressBar$()
{
    var obj = $("$progress$");
    if(obj)
    {
        var pScroll = $getPageScroll$();
        obj.style["left"] = pScroll[0] + "px";
        obj.style["top"] = pScroll[1] + "px";
    }
}

function $ShowBG$(visible)
{
    var obj = $("$BackgroundDiv$");
    var oIfrm = $("$BackgroundDivShim$");
    if(obj==null)
    {
        var oDiv;
	try{oDiv = document.createElement("<div>")}catch(e){oDiv = document.createElement("div")}
        oDiv.id = "$BackgroundDiv$";
        document.body.appendChild(oDiv);
        obj = $("$BackgroundDiv$");
        obj.style["backgroundColor"] = "#333";
        obj.style["opacity"] = "0.8";
        obj.style["filter"] = "alpha(opacity=80)";
        obj.style["-moz-opacity"] = "0.80";
        if(__IsIE)
        {
            obj.innerHTML = "<iframe id='$BackgroundDivShim$' scrolling='no' frameborder='0' style='position:absolute; top:0px; left:0px; display:none;filter=progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);'></iframe>";
            oIfrm = $("$BackgroundDivShim$");
        }
    }
    obj.style["z-index"] = "500";
    obj.style["width"] = "100%";
    obj.style["position"] = "absolute";
    obj.style["left"] = "0px";
    obj.style["top"] = "0px";
    obj.style["height"] = $getPageSize$()[1] + "px";
    obj.style["display"] =  visible ? "block" : "none";
    if(__IsIE)
    {
        oIfrm.style["z-index"] = "300";
        oIfrm.style["width"] = "100%";
        oIfrm.style["height"] = obj.offsetHeight;
        oIfrm.style["display"] =  visible ? "block" : "none";
    }
}

function EncodeMessage(str)
{
    str = str.replace(/<script[^>]*>([\u0001-\uFFFF]*?)<\/script>/gi,"").replace(/\t/gi,"&nbsp;&nbsp;&nbsp;").replace(/\n/gi,"<br/>");
    return str;
}
var $EncodeMessage$ = EncodeMessage;
function $createDelegate$(obj,method) 
{
    return function() 
    {
        return method.apply(obj,arguments);
    }
}
function $ShowMessageBox$(title,message,obj,callBack,width)
{
    if(width) $MessageBoxObj$.style["width"] = width+"px";else $MessageBoxObj$.style["width"]="600px";
    $TitleObj$.innerHTML = title;
    $MessageObj$.innerHTML = message;
    __ShowMessageBox(true,obj,callBack);
}
function __ShowMessageBox(visible,obj,callBack)
{
    try{if(__P_OK_V) $("__P_OK").value =__P_OK_V;if(__P_C_V) $("__P_C").value = __P_C_V;}catch(e){}
    if(visible)
    {
        $MessageBoxObj$.style["position"] = "absolute";
        $MessageBoxObj$.style["z-index"] = "1000";
        try{$AddHandler$("click",$("__P_OK"),callBack,obj);}catch(e){}
    }
    else
    {
        try{$RemoveHandler$("click",$("__P_OK"),callBack);}catch(e){}
    }
    $MessageBoxObj$.style["display"] =  visible ? "block" : "none";
    $ShowBG$(visible);
    __Center($MessageBoxObj$);
}
function $EndMessageBox$()
{
    __ShowMessageBox(false);
    try{$("$divIput$").style.display = "";}catch(e){}
}
var $ONCancelClick$ = $EndMessageBox$;
function __Center(div) 
{
    var pScroll = $getPageScroll$();
    var pSize = $getPageSize$();
    var obj = $getPos$(div);
    div.style["left"] = ((pScroll[0] + (pSize[2] - obj.wb) / 2)) + "px";
    div.style["top"] = ((pScroll[1] + (pSize[3] - obj.hb) / 2)) + "px";
}
function __CenterMessageBox()
{
    if($MessageBoxObj$)__Center($MessageBoxObj$);
}
function $Enter$(event,objId)
{
    var keycode; 
    if(window.event) 
        keycode = event.keyCode; 
    else 
        keycode = event.which;   
    if(keycode == 13 || keycode==108)
    {
        var obj = $(objId);
        if(obj)
        {
            obj.focus();
        }
        return false; 
     }
}
function $AddHandler$(type,target,handler,owner)
{
    var eventHandler = handler;
    if(owner)
    {
        eventHander = function(e)
        {
            handler.call(owner,e);
        }
    }
    else
    {
        eventHander = function(e)
        {
            handler.call(window,e);
        }
    }
    try
    {
        if(target.addEventListener)
        {
            target.addEventListener(type,eventHander,false);
        }
        else if( target.attachEvent)
        {
            target.attachEvent("on"+type, eventHander);
        }
        if(!target.eventList) target.eventList = new Array();
        target.eventList[target.eventList.length] = {en:type,hl1:handler,hl2:eventHander};
    }catch(e){}
}
function $RemoveHandler$(type,target,handler)
{
    try
    {
        var eventHander = handler;
        var i = 0;
        if(target.eventList)
        {
            for(;i<target.eventList.length;i++)
            {
                if(target.eventList[i].en==type && target.eventList[i].hl1==handler)
                {
                    eventHander = target.eventList[i].hl2;
                    break;
                }
            }
            if(i<target.eventList.length)
            {
                for(;i<target.eventList.length-1;i++)
                {
                    target.eventList[i] = target.eventList[i+1];
                }
                target.eventList.length -= 1;
            }
        }
        if(target.removeEventListener)
        {
            target.removeEventListener(type,eventHander,false);
        }
        else if(target.detachEvent)
        {
            target.detachEvent("on"+type,eventHander);
        }
    }catch(e){}
}
if(window.addEventListener)
{
    window.addEventListener("scroll", $SetProgressBar$, false);
    window.addEventListener("scroll", __CenterMessageBox, false);
}
else if( window.attachEvent)
{
    window.attachEvent("onscroll", $SetProgressBar$);
    window.attachEvent("onscroll", __CenterMessageBox);
}
function GetString(str,len,strReplace)
{
     var strlen = 0;
     var s = "";
    for(var i = 0;i < str.length;i++)
    {
            if(str.charCodeAt(i) > 128)
             strlen += 2;
            else
            strlen++;
            s += str.charAt(i);
            if(strlen >= len)
            {
                if(strReplace)
                {
                    s = s + strReplace;
                }
                else
                {
                    s = s+"...";
                }
                return s;
            }
    }
    return s;
}
var $GetString$ = GetString;
function __containsCssClass(element, className) {
    return __contains(element.className.split(' '), className);
}
function __contains(arr,obj)
{
    var r = false;
    for(var i=0,k=arr.length;i<k;i++)
    {
        if(arr[i]==obj)
        {
            r = true;
            break;
        }
    }
    return r;
}
function $AddCssClass$(element, className) {
    if (!__containsCssClass(element, className)) {
        if (element.className === '') {
            element.className = className;
        }
        else {
            element.className += ' ' + className;
        }
    }
}
function $RemoveCssClass$(element, className) {
    var currentClassName = ' ' + element.className + ' ';
    var index = currentClassName.indexOf(' ' + className + ' ');
    if (index >= 0) {
        element.className = $trim$((currentClassName.substr(0, index) + ' ' +
            currentClassName.substring(index + className.length + 1, currentClassName.length)));
    }
}
function $ToggleCssClass$(element, className) {
    if (__containsCssClass(element, className)) {
        $RemoveCssClass$(element, className);
    }
    else {
        $AddCssClass$(element, className);
    }
}
function GetLanguageLabel(selid,value)
{
    var domDiv = $get(selid);
    if(domDiv!=null)
    {
        for (var index = 0; index < domDiv.options.length; ++index) 
        {
            if(domDiv.options[index].value.toLowerCase()==value.toLowerCase())
            {
                return domDiv.options[index].text;
                break;
            }
        }
    }
    return value;
}
var $GetLanguageLabel$=GetLanguageLabel;
function RendPageNavigator(data,divID,onclickFunc)
{
    var domDiv = $(divID);
    if(domDiv!=null)
    {
        if(__containsCssClass(domDiv, "DisplayNone"))
        {
            $RemoveCssClass$(domDiv, "DisplayNone");
        }
        if(data.pageCount<2)
        {
             $AddCssClass$(domDiv, "DisplayNone");
             domDiv.innerHTML = "";
             return;
        }
        var re=/\{0\}/gi;
        var re1=/\{1\}/gi;                  
        var strSelect = "<span class='page_select'>{0}</span>&nbsp;";
        var strUnSelect = "<span class='page_none grey10'><a href='javascript:void (0)' onclick='{1}({0})'>{0}</a></span>&nbsp;";
        var strOther = "<span class='page_none grey10'><a href='javascript:void (0)' onclick='{1}({0})'>...</a></span>&nbsp;";
        
        
        var index = data.PageIndex - 4;
        var end = data.PageIndex+5;
        if(index<1) index = 1;                                        
        if(end>data.pageCount) end = data.pageCount;
        if(end-index<9)
        {
            if(index>1) 
            {
                index = end-9;
                if(index<1) index = 1;
            }
            else if(end<data.pageCount)
            {
                end = index+9;
                if(end>data.pageCount) end = data.pageCount;
            }
        }
        var listBuilder = "";
        if(index>1) listBuilder += strOther.replace(re, index-1).replace(re1, onclickFunc);
        for (;index< end+1; ++index) 
        {
            if(index==data.PageIndex)
            {
                listBuilder += strSelect.replace(re, index);
            }
            else
            {
                listBuilder += strUnSelect.replace(re, index).replace(re1, onclickFunc);
            }
        }
        if(end<data.pageCount) listBuilder += strOther.replace(re, end+1).replace(re1, onclickFunc);
        domDiv.innerHTML = listBuilder;
    }
}
function RendPage(data,divID,sHome,sPre,sLast,sNext,sSel,sUnSel)
{
    var domDiv = $get(divID);
    if(domDiv!=null)
    {
        if(Sys.UI.DomElement.containsCssClass(domDiv, "DisplayNone"))
        {
            Sys.UI.DomElement.removeCssClass(domDiv, "DisplayNone");
        }
        if(data.pageCount<2)
        {
             Sys.UI.DomElement.addCssClass(domDiv, "DisplayNone");
             domDiv.innerHTML = "";
             return;
        }
        var re=/\$I\$/gi;
        
        var index = data.PageIndex - 4;
        var end = data.PageIndex+5;
        if(index<1) index = 1;                                        
        if(end>data.pageCount) end = data.pageCount;
        if(end-index<9)
        {
            if(index>1) 
            {
                index = end-9;
                if(index<1) index = 1;
            }
            else if(end<data.pageCount)
            {
                end = index+9;
                if(end>data.pageCount) end = data.pageCount;
            }
        }
        var listBuilder = new Sys.StringBuilder();
        if(index>1)
        {
            listBuilder.append(sHome);
            listBuilder.append(sPre.replace(re, data.PageIndex-1));
        }
        for (;index< end+1; ++index) 
        {
            if(index==data.PageIndex)
            {
                listBuilder.append(sSel.replace(re, index));
            }
            else
            {
                listBuilder.append(sUnSel.replace(re, index));
            }
        }
        if(end<data.pageCount) 
        {
            listBuilder.append(sNext.replace(re, data.PageIndex+1));
            listBuilder.append(sLast);
        }
        domDiv.innerHTML = listBuilder.toString();
    }
}

if (window.HTMLElement) {
  HTMLElement.prototype.__defineSetter__("outerHTML",function(sHTML) {
        var r=this.ownerDocument.createRange();
        r.setStartBefore(this);
        var df=r.createContextualFragment(sHTML);
        this.parentNode.replaceChild(df,this);
        return sHTML;
    });

    HTMLElement.prototype.__defineGetter__("outerHTML",function() {
     var attr;
        var attrs=this.attributes;
        var str="<"+this.tagName.toLowerCase();
        for (var i=0;i<attrs.length;i++) {
            attr=attrs[i];
            if(attr.specified)
                str+=" "+attr.name+'="'+attr.value+'"';
        }
        if(!this.canHaveChildren)
            return str+">";
        return str+">"+this.innerHTML+"</"+this.tagName.toLowerCase()+">";
        });

   HTMLElement.prototype.__defineGetter__("canHaveChildren",function() {
     switch(this.tagName.toLowerCase()) {
         case "area":
         case "base":
         case "basefont":
         case "col":
         case "frame":
         case "hr":
         case "img":
         case "br":
         case "input":
         case "isindex":
         case "link":
         case "meta":
         case "param":
         return false;
     }
     return true;
   });
}

function GetFormatDate(sFormat,sDateText,sDate)
{
    var arr1 = sFormat.split(":");
    var arr2 = sDate.split(":");
    var tmp = "";
    if(arr2[0]>0)
    {
        tmp = sDateText.replace("{0}",arr2[0]).replace("{1}",arr1[0]);
    }
    else if(arr2[1]>0)
    {
        tmp = sDateText.replace("{0}",arr2[1]).replace("{1}",arr1[1]);
    }
    else if(arr2[2]>0)
    {
        tmp = sDateText.replace("{0}",arr2[2]).replace("{1}",arr1[2]);
    }
    else if(arr2[3]>0)
    {
        tmp = sDateText.replace("{0}",arr2[3]).replace("{1}",arr1[3]);
    }
    else if(arr2[4]>0)
    {
        tmp = sDateText.replace("{0}",arr2[4]).replace("{1}",arr1[4]);
    }
    else if(arr2[5]>0)
    {
        tmp = sDateText.replace("{0}",arr2[5]).replace("{1}",arr1[5]);
    }
    return tmp;           
}

function CreateGoogle(w,h,f,t,ch,c1,c2,c3,c4,c5)
{
    ;
}